import java.util.HashMap;
import java.util.Map;

/**
 * @USER: Administrator
 * @DATE: 2024/9/27 下午10:00
 * @VERSION: 1.0.0
 */
public class LC1725 {
    public static void main(String[] args) {

    }

    public int countGoodRectangles(int[][] rectangles) {
        int maxLen=Math.min(rectangles[0][0], rectangles[0][1]);
        Map<Integer, Integer> map = new HashMap<>();
        for (int[] rectangle : rectangles) {
            int max = Math.min(rectangle[0], rectangle[1]);
            map.put(max, map.getOrDefault(max, 0) + 1);
            if (max > maxLen) {
                maxLen = max;
            }
        }
        return map.getOrDefault(maxLen, 0);
    }
}
